interface Subject {
    method(): void
}

class RealSubject implements Subject {
    method(): void {
        console.log('执行了真实实体的method方法');
    }

}

//代理类中放了，被代理对象
export class Proxy implements Subject {
    declare private rs: RealSubject
    constructor() {
        this.rs = new RealSubject()
    }
    method(): void {
        console.log('执行了代理类的method方法');
        this.rs.method()
    }

}


console.log('-----不使用代理类-----');
const rs = new RealSubject()
rs.method()

console.log('-----使用代理类-----');
const proxy = new Proxy()
proxy.method()
